Device for extracting the square root of a binary number

ABSTRACT

A device for extracting the square root of a binary number, comprising an input shift register receiving the successive digits of the said number from which successive groups of two consecutive digits are extracted and momentarily stored in two unitary memories under the control of a time base. The successive groups are applied to an adder and to a selector circuit. The adder also receives signals from an intermediate register displaying the already found digits of the wanted square root. The selector circuit delivers different signals according to the value of the last found digits of the root. The output of the adder accordingly controls the intermediate register which in turn controls an answer register displaying the digits of the root.

United States Patent 91 Mignot DEvicE FOR EXTRACTING THE SQUARE ROOT OF A BINARY NUMBER Lucien E. Mignot, Saint-Mande, France [75] Inventor:

Etablissement Public de Diffusion, Paris, France [22] Filed: May 7, 1974 [21] Appl. No.: 467,808

[73] Assignee:

REG/S TER SELECTOR CIRCUIT SET 70 ZERO Mam/we TIME BASE 1 1 Sept. 16, 1975 3,610904 10/1971 Kumagai 235/158 Primary ExaminerDavid H. Malzahn Attorney, Agent, or Firm-Abraham A. Saffitz 5 7 ABSTRACT A device for extracting the square root of a binary number, comprising an input shift register receiving the successive digits of the said number from which successive groups of two consecutive digits are ex tracted and momentarily stored in two unitary memories under the control of a time base. The successive groups are applied to an adder and to a selector circuit. The adder also receives signals from an intermediate register displaying the already found digits of the wanted square root. The selector circuit delivers diffcrent signals according to the value of the last found digits of the root The output of the adder accordingly controls the intermediate register which in turn controls an answer register displaying the digits of the root.

2 Claims, 3 Drawing Figures 0474 INPUT 6 ANSWER REG/5 rm Ell 0 DEVICE FOR EXTRACTING THE SQUARE ROOT OF A BINARY NUNIBER This invention relates to an apparatus for extracting the square root of a binary number.

The mode of operation of the apparatus of the invention will be better understood by describing a typical example of the successive partial operations accomplished by said apparatus, starting from the digits of the binary number the root of which is to be extracted and finally displaying the wanted square root.

The computing apparatus of the invention enables the square root of a given binary number N containing for example (2n-i-2) binary digits or significant bits to be quickly calculated; let us write:

N=a '2 +a ,,'2 .+a '2+a,,' 2

the known quantities being the binary digits a a The root R sought contains at the maximum (n+1) significant figures and can be written as follows:

The digits of the square root are calculated in (n+1 successive cycles, one digit per cycle, in the order r The known mathematical results on which the operation of the apparatus is based are recapitulated in the following. The binary digit of rank i (reckoned from the left) of the root R, say r,,.,, is determined as being the carry forward of the addition of two binary numbers. It depends on the results obtained for the preceding digit n-i+r If r,, l, the digit r,, is the carry-forward of the addition of two binary numbers A,, and B,, whereas if r,, 0, the digit r,. is the carry-forward of the additionof two binary numbers A,, and B,,

When i O n AN, 27|+1 2" This addition may be written in binary notation:

then n-l 1)?! 0)n Zn-l 211-2 and if r O.

13,, 1 E l 1 F; being the complement of r,,.

There are therefore two cases for the determination of r,,

l. First case: r,,. 1 Then, designating by 2,, the binary expression:

rr-H4 '2i-1)n-i+1 '2i-2)ni+1 'o)ni+1 one may write:

rt-i In both cases A,, and A,, are numbers containing 2(i+1) digits.

In both cases:

This number likewise contains 2(i+l) digits.

The apparatus comprises an adder which receives, at its respective inputs A and B, the two binary numbers A or A a, on one hand, and B on the other hand, said numbers having been made up in suitable registers or memories, adds them together and feeds the carryforwards of the addition to a shift register. In the description which follows, the numbers A,, and A,, are treated as identical and designated as the number A d which can therefore take two different forms according to the value of r,,

At each calculating cycle 1' the remainder resulting from the preceding cycle is less than or at most equal to twice the root found r r,, r,, therefore includes at the maximum (i+2) significant digits. In the case of the cycle (i+l), it is necessary to take into account the two following digits of the given number the square root of which is to be found. There could therefore be (i+4) significant digits at the input I of the adder for the calculating cycle (i-H and consequently (1+3) digits for the cycle i. The maximum capacity of the adder will accordingly be reached with the calculation of r,, for Fri. Consequently, the adder should be capable of adding two numbers containing (n+3) digits, i.e. two digits more than the maximum number of significant digits of the root.

The invention will now be described in more detail, by way of example only, with reference to the accompanying drawings, in which:

FIG. 1 shows the logical circuit diagram of the appa ratus;

FIG. 2 shows an algorithm indicating the phases of the operations in each cycle; and

FIG. 3 shows a detail of the circuit element 3 of H0.

In the figures, like elements are denoted by like references, letters or numbers.

The circuit for the extraction of square roots essentially comprises a first input shift register 1, a second (intermediate) shift register 2 for continuously forming the square root, a selector circuit 3, two unitary memories 4 and 5, an adder 6, a buffer storage unit 7, a time base 8 and a result register (answer register) 9.

The bits a to a of the number N the square root of which is required may be fed in parallel to the input of the input register 1 controlled by a data input pulse applied to the terminal 11 of the latter register by the time base 8. Under the control of forward pulses applied to the input 12 of 1] by the time base 8, the shift register 1 advances by two digits at each forward pulse and feeds to two unit memories 4 and 5 the couples of digits 11 a then a a finally a,, d

The shift (intermediate) register 2 is fed at its series input 21 with the complement f of the addition carryforward delivered by the adder 6 and stored in the buffer storage unit 7. More precisely, the signal r appearing at the output 64 of the adder 6 is applied an inverter circuit 10, the output of which is connected to the buffer storage 7. The output of the buffer storage unit is connected to the series input 21 of the intermediate register 2. This register has two functions: it delivers the result at the end of the calculation or more precisely, a number the digits which are the complements of those of the result, to the results register 9, and during the calculation it supplies a part of the number B,, The outputs of the shift register 2 are numbered 23,, to 23,, and are respectively connected to the inputs 61 to 61,, of the adder 6, that is, with a shift of two binary orders. The outputs 23,, to 23, of the shift register 2 are connected respectively to the inputs 91,, to 91,, of the results (answer) register 9.

The logical (selector) circuit 3 comprises 2 (n+2) pairs of input terminals 31,, to 31,, and 32,, to 32 and (n+2) output terminals 33,, to 33,, The input terminals 31 to 31 are respectively connected to n out put terminals 33,, to 33,, The (n+2) input terminals 32,, to 32 are respectively connected to (n+2) output terminals 63,, to 63,, of the adder 6. The terminals 31,, and 31, are respectively connected to the outputs of the unitary memories 4 and 5.

Details of the logical circuit 3 are shown in FIG. 3. It comprises (n+2) cells two only of which, those of rank j and of rank (n+1) are shown in the drawing. Each cell includes an AND-gate 34 the inputs of which are connected to terminals 32 and a bus bar to which is applied the signal r and an AND-gate 35 the inputs of which are connected to terminals 31 and a bus bar to which is applied the signal T. The outputs of the AND-gates 34 and 35 are connected to an OR-gate 36 the output of which is itself connected to a unitary memory 37. This unitary memory is controlled by the time base (or clock) 8. The selector circuit 3 is intended to provide the number A It will be seen that the result of the addition, i.e. the number 2,, is applied to the inputs 32, while the number A,, (or A,, is applied to the inputs 31, and that the logical circuit provides the first or the second of these numbers depending on whether r is equal to one or to zero. The two last digits to form A or A,, are added in the adder, as will be seen.

The adder 6 is an adder for two binary numbers with (n+3) digits. It includes in the first place, (n+3) inputs 61,, to 61,, intended for the input of the number B,, the first two elements of which are permanently connected to the logical level (+1 and the other ones, 61 to 61 are respectively connected to the outputs 23,, to 23,, of the shift register 2, and in the second place (n+3) inputs 62,, to 62,, intended for the input of the number A,, and the first two elements of which are permanently connected to the outputs 33,, to 33,, of the logical circuit 3.

The operation of the time base 8 is shown in the algorithm of FIG. 2. It includes two phases and (4),),- per cycle. It provides the different clock signals required for the functioning of the circuits of FIG. 1 and indicated by the letter I: in FIG. 3. The phase 4),, controls the circuits 2,3,4 and and the phase 4),, the circuits 1 and 7. During the phase the following operations take palce; the building up, apart from their last two digits, of A,, in 3 and B,, in 2, forward shift of the register 2 by one row or place or rank, storing of a and a in the unitary memories 4 and 5, calculation of 2,, and of r,, In phase the following operations take place: storing of r,, in the memory 3, shift of two rows or places in the input register 2 and selection in this register of a and a The wave front of the pulse ((1) should cause the appearance at the output of circuit 3 either of the preceding addition result 2,, if r,, is equal to l, or of the number A,,-,-,,, if r,, is equal to 0. Once the correct input variable has been processed in the circuit 3, the memories 4 and 5 are loaded so as to have at their inputs the binary digits a and a so that A,, appears at the input of the adder 6. At the same time, the intermediate register 2 is shifted by one row or place, which brings Fm to the output 0 of the register 2, so that the number B,, is the second number present at the input of the adder 6.

The circuit 8 also includes an output labelled initialization the object of which, during the reception of the signal corresponding to the request for calculation, is to introduce suitable input or output data in the various circuits of the assembly while the initialization signal lasts. This signal performs the following operations:

1. Setting to l the register 2;

2. Setting to O the outputs of the logical circuit 3;

3. Setting to l the buffer storage 7 to 1 and the unitary memories 4 and 5; 4. Feeding the known quantities (data) a, to a to the input register 1.

It may be remarked that, after initialization during the cycle i 0, there are really a and a digits at the inputs 62,, and 62, of the adder 6, all the other inputs 62 to 62,, being set to O, and all the inputs 61,, to 6l,, being set to l.

The termination of the initialization pulse gives rise to the starting of (n+1) computing cycles.

When cycle i= n+1 arrives, the time base ceases to emit pulses qb and A final pulse is a signal that the time base has fulfilled its part.

A partial result of the square root calculation in the shape of its complement then appears at the output terminals 23,, to 23,,.

The remainder of the square root value is available at the output of circuit 3 if this circuit is constituted as indicated in FIG. 3. The binary digit with a weighting of 2 of the remainder appears at the output of the OR- circuit 36 (FIG. 3) at the conclusion of the operation. The first (n+1) digits of the remainder therefore each appear at the output of the logical combined assembly which drives the memory element 37 of each cell of the circuit 3. It is obviously necessary to provide an identical combined assembly so as to form the binary digit with the greatest weight in the remainder.

By way of example, the extraction of the square root of the number N=l00l00=36 will be given in the following. In this case, we have:

Cycle 1' 0 Outputs 23 to 23,, of circuit 2 (all set to l Inputs 61, to 61,, of circuit 6 (all set to l):

B =[l l l l 1 Inputs 62,, to 62,, of circuit 6 (all set to 0 except the last two which are on a and a A =[000 ]a a =O1O Total in circuit 6:

wherefrom r 1; (09 0; (0.9 1 Cycle 1' l Outputs 23 to 23 of circuit 2 (all set to 1 except the last on f) Inputs 32;, to 32 of circuit 3:

Since r l, the signal (2) is selected as the output signal of circuit 3.

Inputs 62 to 62 of circuit 6:

Total in circuit 6:

II II ll n n). '2), n). 0). 0 0 0 whence 3)1 '2)i '1)i 'n)1 0 Cycle i= 2 Outputs 23 to 23 of circuit 2:

l EPI= l O 0 Inputs 61 to 61 of circuit 6:

B l 0 O l 1 Inputs 31 to 31 of circuit 3:

( 'i)2 102 s 0 1 0 l Inputs 32 to 32 of circuit 3:

(a ),(a ),(o' ),(m,) O O O O Since r l the signal (4) is selected as the output signal of circuit 3.

Inputs 64 to 64 of circuit 6:

A =O00a a =00O00 Total in circuit 6:

ll ll ll ooc whence r 0 The square root is therefore:

Since r O, the remainder is given by the signal appearing at the inputs 31 to 31 of circuit 3, that is to say 0 O 0 O 0.

Numerous variants of embodiment are possible and come within the scope of the invention. More particularly, the input shift register could be replaced by two shift registers, one for the odd digits, the other for the even digits of the number from which the square root is to be extracted, a shift of one step in each register being carried out at each cycle.

The input register could also be replaced by two addressable registers receiving respectively the even and odd binary digits. The digits used in each computing cycle could then be obtained at the output by locating pulses delivered by the time base 8.

What I claim is:

1. Apparatus for the extraction of the square root of a given binary number having 2(n+l) digits, comprismg:

means including an input shift register controlled by a time base for recording said given binary number and for successively extracting (n+1 two-digit groups from said given binary number;

two unitary memories for storing said extracted twodigit groups;

an intermediate shift register recording in succession the found digits of the square root;

means controlled by said intermediate register for building up a first further binary number having (n+3) digits which, starting from the zero weight binary digit, are two ones, then the complements t0 the already found digits of the square root, and finally ones;

an adder adding said first further binary number to a second further binary number;

a selector circuit receiving a first auxiliary binary number from said adder and a second auxiliary binary number;

said second further binary number being formed by the output number from said selector circuit, the digits of which have been shifted two binary places to the upper weight end and the two digit places on the zero weight end of which are a group of two digits of said given binary number which is received from said unitary memories;

said selector circuit including means for selecting said first auxiliary number from said adder when the last proceeding found digit of the square root is a one and also including means for selecting said second auxiliary number when the last preceeding found digit of the square root is a zero"; and,

means for feeding the successive carry forwards of the addition from the adder to said intermediate register whereby the digits of the wanted square root are obtained as these successive carry forwards in addition to said first and second further binary numbers.

2. Apparatus for extracting the square root of a given binary number as claimed in claim 1, further comprising a clock circuit furnishing two phases per cycle, the first phase controlling said means for building up said first binary number, said selector circuit and said two unitary memories linked with the input register. and the second phase controlling said memory linked with said adder. 

1. Apparatus for the extraction of the square root of a given binary number having 2(n+1) digits, comprising: means including an input shift register controlled by a time base for recording said given binary number and for successively extracting (n+1) two-digit groups from said given binary number; two unitary memories for storing said extracted two-digit groups; an intermediate shift register recording in succession the found digits of the square root; means controlled by said intermediate register for building up a first further binary number having (n+3) digits which, starting from the zero weight binary digit, are two ''''ones'''', then the complements to the already found digits of the square root, and finally ones; an adder adding said first further binary number to a second further binary number; a selector circuit receiving a first auxiliary binary number from said adder and a second auxiliary binary number; said second further binary number being formed by the output number from said selector circuit, the digits of which have been shifted two binary places to the upper weight end and the two digit places on the zero weight end of which are a group of two digits of said given binary number which is received from said unitary memories; said selector circuit including means for selecting said first auxiliary number from said adder when the last preceeding found digit of the square root is a one and also including means for selecting said second auxiliary number when the last preceeding found digit of the square root is a ''''zero''''; and, means for feeding the successive carry forwards of the addition from the adder to said intermediate register whereby the digits of the wanted square root are obtained as these successive carry forwards in addition to said first and second further binary numbers.
 2. Apparatus for extracting the square root of a given binary number as claimed in claim 1, further comprising a clock circuit furnishing two phases per cycle, the first phase controlling said means for building up said first binary number, said selector circuit and said two unitary memories linked with the input register, and the second phase controlling said memory linked with said adder. 